#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <math.h>
#include <inttypes.h>
#include <string.h>

typedef struct {
    char id[128];
    int personal_score;
    int final_score;
} student_entry;

int students = 0;
student_entry* student_entries = NULL;

int find_student(char id[128]) {
    for (int i = 0; i < students; i++) {
        if (strcmp(student_entries[i].id, id) == 0) {
            return i;
        }
    }
    return -1;
}

void append_new_student(student_entry entry) {
    if (students == 0) {
        student_entries = (student_entry*) calloc(++students, sizeof(student_entry));
    } else {
        student_entries = (student_entry*) realloc(student_entries, sizeof(student_entry) * ++students);
    }
    student_entries[students - 1] = entry;
}

int rank_to_score(int rank) {
    if (rank < 13) {
        return 32;
    } else if (rank < 25) {
        return 16;
    } else if (rank < 49) {
        return 8;
    } else if (rank < 97) {
        return 4;
    } else if (rank < 193) {
        return 2;
    } else {
        return 1;
    }
}

int calc_final_score(int personal_score, int max_score) {
    return round(100 + log(1 + ( (double) (personal_score - max_score) / (double) max_score)) * 10.0);
}

int main(void) {
    while (1) {
        int question_id;
        char student_id[128];
        int rank;
        if (scanf("%d%s%d", &question_id, student_id, &rank) == EOF) {
            break;
        }
        int stu_pos = find_student(student_id);
        if (stu_pos == -1) {
            student_entry new_entry;
            strcpy(new_entry.id, student_id);
            new_entry.personal_score = rank_to_score(rank);
            append_new_student(new_entry);
        } else {
            student_entry* entry = &student_entries[stu_pos];
            entry -> personal_score += rank_to_score(rank);
        }
    }
    
    // 计算最终分数
    int max_score = 0;
    for (int i = 0; i < students; i++) {
        if (student_entries[i].personal_score > max_score) {
            max_score = student_entries[i].personal_score;
        }
    }
    for (int i = 0; i < students; i++) {
        student_entries[i].final_score =
            calc_final_score(student_entries[i].personal_score, max_score);
    }
    
    // 冒泡排序
    for (int i = 0; i < students; i++) {
        for (int j = 0; j < students - 1; j++) {
            if (student_entries[j].final_score < student_entries[j + 1].final_score) {
                student_entry tmp_entry = student_entries[j];
                student_entries[j] = student_entries[j + 1];
                student_entries[j + 1] = tmp_entry;
            }
        }
    }
    for (int i = 0; i < students; i++) {
        for (int j = 0; j < students - 1; j++) {
            if (student_entries[j].final_score == student_entries[j + 1].final_score &&
                strcmp(student_entries[j].id, student_entries[j + 1].id) > 0) {
                student_entry tmp_entry = student_entries[j];
                student_entries[j] = student_entries[j + 1];
                student_entries[j + 1] = tmp_entry;
            }
        }
    }
    
    // 输出
    for (int i = 0; i < students; i++) {
        printf("%s %d\n", student_entries[i].id, student_entries[i].final_score);
    }
    return 0;
}
